package controller

import (
	"github.com/gin-gonic/gin"
	"github.com/jmoiron/sqlx"
	"vip_video/configx"
	"vip_video/internal/library"
)

type TestController struct {
	Db     *sqlx.DB
	Config *configx.Config
}

func (tc *TestController) WithDb(db *sqlx.DB) *TestController {
	tc.Db = db
	return tc
}

func (tc *TestController) WithConfig(config *configx.Config) *TestController {
	tc.Config = config
	return tc
}

func NewTestController() *TestController {
	return &TestController{}
}

func (tc *TestController) Test(ctx *gin.Context) {
	response := library.NewResponse(ctx)

	token := library.NewTokenLibrary()

	response.Success("pong", &gin.H{
		"token": token.HashHmacToken("075d9f62-1292-4a27-8a4a-a6277940a28a"),
	})
}
